package org.boticelli;

import java.util.Arrays;

import org.acegisecurity.providers.dao.salt.ReflectionSaltSource;
import org.acegisecurity.providers.encoding.ShaPasswordEncoder;
import org.boticelli.auth.BoticelliUserDetails;
import org.junit.Test;

public class UserTestCase
{

    @Test
    public void test()
    {
        ReflectionSaltSource reflectionSaltSource = new ReflectionSaltSource();
        reflectionSaltSource.setUserPropertyToUse("getUniqueUserId");

        BoticelliUserDetails ud = new BoticelliUserDetails("testuser", "RqNeDS3DVYa", Arrays
                .asList("ROLE_USER"), false);

        ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
        String pw = encoder.encodePassword(ud.getPassword(), reflectionSaltSource.getSalt(ud));
        System.out.println(pw);
    }

}
